﻿using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MiniFox.Configurations
{
    /// <summary>
    /// 
    /// </summary>
    public class AssemblySetting
    {
        const string NAME = "assemblyName";
        const string PATH = "assemblyPath";
        
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName(NAME)]
        public string AssemblyName
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName(PATH)]
        public string AssemblyPath
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        public string FullName
        {
            get
            {
                string path;
                if (!string.IsNullOrEmpty(AssemblyPath))
                {
                    path = AssemblyPath.Trim('\\');
                }
                else
                {
                    path = AppDomain.CurrentDomain.BaseDirectory.Trim('\\');
                }

                return path + "\\" + AssemblyName.Trim('\\');
            }
        }
    }
}
